import signal
import traceback
from multiprocessing import Process
from django.core.management.commands import runserver
from pyim import server


class Command(runserver.Command):
    def add_arguments(self, parser):
        super(Command, self).add_arguments(parser)

    def handle(self, *args, **options):
        conf = {
            "chdir": ".",
            "log_file": "",
            "pid_file": "pyim.pid"
        }
        try:
            server.start(**conf)
        except Exception:
            traceback.print_exc()
